﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeGame.ServerObjects
{
    class DatabaseManager
    {
        private List<Database> Databases = new List<Database>();

        public Database GetDatabase(Player ply)
        {
            foreach (Database item in this.Databases)
            {
                if (item.OwningPlayer == ply)
                {
                    return item;
                }
            }
            
            return this.CreateDatabase(ply);
        }

        public Database CreateDatabase(Player ply)
        {
            Database database = new Database(ply);
            this.Databases.Add(database);
            return database;
        }
    }
}
